<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login Form</title>
<link rel="stylesheet" type="text/css" href="ubms.css" media="screen" />
<script language="JavaScript">
function empty(str) {
	if (str == "" || str.length == 0) {
		return true;
	} else {
		return false;
	}
}

function lenCheck(str) {
	if (empty(str) || str.length > 16) {
		return true;
	} else {
		return false;
	}
}

function checkValue() {
	var id = document.form1.username.value;
	var pw = document.form1.passwd.value;

	var valid = true;
	var msg = "";
	
	if(lenCheck(id))
	{
		msg = msg + "Username should be any alphanumeric string with 16 characters or less.\n";
	 	valid = false;
	}
	 
	if(lenCheck(pw))
	{
		msg = msg + "Password should be any alphanumeric string with 16 characters or less.";
		valid = false;
	}

	if (!valid) {
		alert(msg);
	}

	return valid;
}
</script>
</head>

<body>

<center>
<h2>UBMS Login Page</h2>

<hr>

<form method="post" action = "login.jsp" name = "form1" onSubmit="return checkValue();">
	<center>
 	<table class="tab_login">
  		<tr>
  			<td colspan = "2" height = "21"> <center>Log in</td>
  		</tr>
  		<tr>
  			<td width="30%">User Name</td>
  			<td width="70%"><input class="input_1" type = "text" name = "username" maxLength="16"></td>
  		</tr>
  		<tr>
  			<td> Password </td>
  			<td> <input class="input_1" type="password" name="passwd" maxLength="16"></td>
  		</tr>
  		<tr>
  			<td height = "42" colspan = "2">
  				<center> <input type = "submit" name = "submit" value = "Login">
</form>  	
<form action = "userRegisterForm.jsp" name = "form2">
				<input type = "submit" name = "submit"  value = "New to Our System?">
</form>
  			</td>
  		</tr>
 	</table>
</body>
</html>